import { getRandomDateTime, getNowDate, getFeatureDate } from '../../../utils'
import Mock from 'mockjs'
export const sensitiveWordMock = pageSize => {
  const result: any[] = []
  for (let i = 0; i < pageSize; i++) {
    const num = Mock.mock('@integer(1, 3)')
    const codeList = ['广告', '色情', '敏感', '暴恐', '政治']
    const indexArr: number[] = []
    const tags: string[] = []
    for (let i = 0; i < num; i++) {
      const index = Mock.mock('@integer(0, 4)')
      if (indexArr.includes(index)) {
        i--
      } else {
        indexArr.push(index)
        tags.push(codeList[index])
      }
    }
    result.push({
      id: i + 1,
      name: Mock.mock('@ctitle'),
      remark: Mock.mock('@csentence()'),
      status: Mock.mock('@integer(0, 1)'),
      tags,
      creator: '1',
      create_time: getRandomDateTime(getFeatureDate(-10), getNowDate()),
      updater: '',
      update_time: '',
      deleted: false,
      deleted_time: ''
    })
  }
  return result
}
